<?php

namespace Home\Controller;

use Think\Controller;

class SortController extends Controller
{
    public function sort()
    {

        //  获取id

        $id = $_GET['id'];

        // 导航分类

        $model_sort = D('sort');
        $sorts = $model_sort->query("SELECT * FROM sort");
        $this->assign('sorts', $sorts);

        //  当前属于的类
        $sql = sprintf("SELECT * FROM sort WHERE id = '%s' ", $id);
        $sort_es = $model_sort->query($sql);
        $this->assign('sort_es', $sort_es);


        //  关于该类的所有商品

        $model_goods = D('goods');
        $sql = sprintf("SELECT * FROM goods WHERE goods_sort = '%s'",$id);
        $goodes = $model_goods->query($sql);
        $this->assign('goodes', $goodes);

        // 友情链接

        $model_link = D('link');
        $links = $model_link->query("SELECT * FROM link");
        $this->assign('links', $links);

        $this->display();
    }

}